import request from '@/utils/request'

export function listCoupon(query) {
  return request({
    url: '/coupon/list',
    method: 'get',
    params: query
  })
}

export function listInMember(query) {
  return request({
    url: '/coupon/listInMember',
    method: 'get',
    params: query
  })
}

export function createCoupon(data) {
  return request({
    url: '/coupon/create',
    method: 'post',
    data,
  })
}

export function readCoupon(id) {
  return request({
    url: '/coupon/read',
    method: 'get',
    params: { id }
  })
}

export function updateCoupon(data) {
  return request({
    url: '/coupon/update',
    method: 'post',
    data
  })
}

export function deleteCoupon(data) {
  return request({
    url: '/coupon/delete',
    method: 'post',
    data
  })
}

export function listCouponUser(query) {
  return request({
    url: '/coupon/listuser',
    method: 'get',
    params: query
  })
}

export function listCouponGoods(query) {
  return request({
    url: '/coupon/goodsList',
    method: 'get',
    params: query
  })
}

export function listCouponRegions(query){
  return request({
    url: '/coupon/regionList',
    method: 'get',
    params: query
  })
}

export function couponStatistics(data) {
  return request({
    url: '/coupon/statistics',
    method: 'get',
    params: data
  })
}

export function listCouponCategory(query) {
  return request({
    url: '/coupon/categoryList',
    method: 'get',
    params: query
  })
}

export function changeCouponStatus(id){
  return request({
     url: '/coupon/changeCouponStatus',
     method: 'post',
     params: id
  })
}

export function couponStatistic(param){
  return request({
    url: '/coupon/couponStatistic',
    method: 'get',
    params: param
  })
}

export function typeStatistic(param){
  return request({
    url: '/coupon/typeStatistic',
    method: 'get',
    params: param
  })
}

export function grantExtenCoupon(data){
  return request({
    url: '/coupon/grantExtenCoupon',
    method: 'post',
    data,
  })
}

export function queryCouponGrant(couponId){
  return request({
    url: '/coupon/queryCouponGrant',
    method: 'get',
    params: {couponId}
  })
}

export function queryOrderInCoupon(query){
  return request({
    url: '/coupon/queryOrderInCoupon',
    params: query,
    method: 'get'
  })
}

export function extenCouponList(){
  return request({
    url: '/coupon/extenCouponList',
    method: 'get'
  })
}

